Skip to content

Expand DocC: config-type reference, rebalances/events, error handling, observability#248

Open
ssikka100 wants to merge 9 commits into
swift-server:mainfrom
ssikka100:docc-current-client
Open

Expand DocC: config-type reference, rebalances/events, error handling, observability#248
ssikka100 wants to merge 9 commits into
swift-server:mainfrom
ssikka100:docc-current-client

Conversation

@ssikka100

@ssikka100 ssikka100 commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Motivation

The DocC catalog added in #240 covers the core produce/consume/secure flow well, but several capabilities the client actually ships had no narrative documentation, the three generated configuration types had no type-level abstracts, and there was no curated organization for members of KafkaConsumer / KafkaProducer.

Modifications

  • Consumer and producer symbol pages — new DocC extension files for KafkaConsumer and KafkaProducer provide prose abstracts, an overview that points at the walkthrough article, and functional topic groups (creating, sending/consuming, running the service, offsets, subscriptions, pausing, seeking, observing events).
  • Configuration type reference — DocC extension files give prose abstracts and overviews to KafkaConfig, KafkaConsumerConfig, and KafkaProducerConfig, with inline <doc:...> links from each config type to SecuringConnections and the relevant walkthrough article.
  • Consumer rebalances + events — a new section in ConsumingMessages demonstrates makeConsumerWithEvents(config:logger:) and iterating KafkaConsumerEvents (previously the events sequence was only linked, never shown), covering assign/revoke/error and cooperative vs eager assignment.
  • Error handling — a new article on where KafkaError surfaces (thrown, event sequences, delivery reports) and how to classify it with isFatal / isRetriable / rdKafkaCode.
  • Observing Kafka clients — a new article covering swift-metrics gauges (ConsumerMetrics / ProducerMetrics) and the structured logging metadata the client attaches (kafka.client.id, kafka.client.type, kafka.group.id). Delivers the observability integration the landing page advertises.
  • Cross-linking — every article surfaces its sibling articles under a Swift-standard ### Articles group at the top of ## Topics, mirroring the pattern used by swift-nio and swift-metrics.

Result

The DocC build is warning-free, the advertised-but-undocumented features (events sequence, error semantics, metrics, logging) now have guides, and KafkaConsumer / KafkaProducer render with curated topic groups so readers can navigate members by responsibility.

Add documentation-extension files providing abstracts and overviews for KafkaConfig, KafkaConsumerConfig, and KafkaProducerConfig, which are generated from .gyb templates and had no type-level doc comments. Documents them without touching the generated sources.
Add an 'Observe rebalances' section to ConsumingMessages demonstrating makeConsumerWithEvents and iterating KafkaConsumerEvents (previously the events sequence was only linked, never shown), and curate the events entry point in Topics.
Add three standalone articles: HandlingErrors (where KafkaError surfaces and how to classify it), Observability (enabling swift-metrics gauges and the structured logging metadata the client attaches), and Migrating (moving off the deprecated Configuration types and commitSync). Link them from the landing page.
@ssikka100 ssikka100 added the semver/none No version bump required. label Jul 11, 2026
@ssikka100
ssikka100 requested a review from FranzBusch July 13, 2026 13:52
Comment thread Sources/Kafka/Kafka.docc/Migrating.md Outdated

@FranzBusch FranzBusch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM

@FranzBusch

Copy link
Copy Markdown
Contributor

@heckj Could you take a look at this as well?

Comment thread Sources/Kafka/Kafka.docc/KafkaConsumerConfig.md Outdated
Comment thread Sources/Kafka/Kafka.docc/KafkaProducerConfig.md Outdated
Comment thread Sources/Kafka/Kafka.docc/HandlingErrors.md Outdated
Comment thread Sources/Kafka/Kafka.docc/Observability.md Outdated
Comment thread Sources/Kafka/Kafka.docc/Observability.md Outdated
Comment thread Sources/Kafka/Kafka.docc/Observability.md Outdated
Comment thread Sources/Kafka/Kafka.docc/Observability.md Outdated
- KafkaConsumerConfig.md, KafkaProducerConfig.md: replace symbol link
  abstracts with narrative prose (heckj)
- HandlingErrors.md: make abstract active voice (heckj)
- Observability.md: rename to 'Observing Kafka clients' to match sibling
  gerunds; active voice; drop librdkafka jargon; parallel imperative
  heading 'Emit structured logs' (heckj)
- Remove Migrating.md — belongs in 1.0 release notes, not DocC (FranzBusch)
@ssikka100
ssikka100 requested a review from heckj July 14, 2026 20:38
@ssikka100 ssikka100 changed the title Expand DocC: config-type reference, rebalances/events, error handling, observability, and migration Expand DocC: config-type reference, rebalances/events, error handling, observability Jul 15, 2026
Adopts the Swift-standard DocC pattern used by swift-nio and swift-metrics:
each article groups related articles under `### Articles` before functional
symbol groups, and `KafkaConsumer` / `KafkaProducer` symbol extensions add
functional topic groups so members render in curated buckets. Config-type
extension files keep their prose abstracts and add inline `<doc:...>` links
to the security and walkthrough articles.
Applies heckj's rule about keeping implementation-detail library names out
of user-facing conceptual prose, extending it to the config extension files
and namespace type.
@heckj

heckj commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I think the commit bfdd4e8 is causing an issue with doc generation. The soundness check is failing, indicating an error with articles curated into a cycle. Very worth fixing that up prior to merging, or SPI (or other systems) likely won't be able to render the docs.

Each article listed every sibling under a Topics '### Articles' group,
which DocC treats as a curation edge in the documentation hierarchy.
The mutual references formed cycles (Observability -> HandlingErrors ->
Observability, etc.), producing warnings on the Documentation soundness
check. The landing page's Essentials group is now the sole curator of
articles; inline <doc:...> links in each article's prose already provide
cross-navigation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants